﻿using System;
using System.Collections.Generic;
using System.Data;
using Loki.Data;
using Loki.Utils;

namespace Loki.Engine.Data
{
    public abstract class LokiDataProvider : LokiService, IDataProvider
    {
        public virtual void Initialize()
        {
        }

        public IDatabaseAdapter Database { get; set; }

        protected IEnumerable<T> WrapperTransactional<T>(Func<IDbTransaction, IEnumerable<T>> P_Wrapped)
        {
            return Database.WrapperTransactional<T>(P_Wrapped);
        }

        protected T WrapperTransactional<T>(Func<IDbTransaction, T> P_Wrapped)
        {
            return Database.WrapperTransactional<T>(P_Wrapped);
        }

        protected void WrapperTransactional(Action<IDbTransaction> P_Wrapped)
        {
            Database.WrapperTransactional(P_Wrapped);
        }
    }
}